package com.mall.product.controller;

import com.mall.entity.TbSpecOption;
import com.mall.entity.TbSpeclification;
import com.mall.product.service.SpecOptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 规范选择控制器
 * created with IntelliJ IDEA
 *
 * @author ASUS
 * @Auther: W
 * @Date: 2021/07/16/14:43
 * Other:  规格选项控制层
 * @date 2021/07/18
 */
@RestController
@RequestMapping("/specOption")
@CrossOrigin
public class SpecOptionController {

    @Autowired
    private SpecOptionService specOptionService;

    /**
     * 根据id查询规格选项
     */
    @GetMapping("/findById")
    public List<TbSpecOption> findById(Integer specId) {
        return specOptionService.findById(specId);
    }

    /**
     * 通过属性主键查询 当前规格所有
     */
    @GetMapping("/findByIdSpec")
    public TbSpeclification findByIdSpec(Integer id){
        return specOptionService.findByIdAll(id);
    }

}
